#{extends 'main.html' /}
#{set title:'index.html' /}
<div class="well">
	<fieldset>
		<legend>Registro de Publicaciones</legend>
		<form class="form-horizontal" action="@{Publicaciones.guardar()}" id="formulario-de-publicacion">
			<div class="control-group">
				<label class="control-label required-form" for="deTitulo">Titulo</label>
				<div class="controls">
					<div class="input-append">
						<input type="text" id="deTitulo" name="publicacion.deTitulo"/>
						<span class="add-on"><i class="icon-"></i></span>
					</div>					
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="stIsNuevo">Nuevo</label>
				<div class="controls">
					<label class="checkbox"><input type="checkbox"/></label>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label required-form" for="nuCantidad">Cantidad</label>
				<div class="controls">
					<input type="text" id="publicacion.nuCantidad"/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label required-form" for="nuPrecio">Precio</label>
				<div class="controls">
					<input type="text" id="publicacion.nuPrecio"/>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label required-form" for="deDescripcion">Descripcion</label>
				<div class="controls">
					<textarea name="publicacion.deDescripcion" id="deDescripcion" rows="" cols=""></textarea>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"></label>
				<div class="controls">
					<button type="button" id="fileupload" class="btn btn-inverse">Foto - 1</button>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"></label>
				<div class="controls">
					<button type="button" id="fileupload" class="btn btn-inverse">Foto - 2</button>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"></label>
				<div class="controls">
					<button type="button" id="fileupload" class="btn btn-inverse">Foto - 3</button>
				</div>
			</div>
			<div class="form-actions">
				<button type="submit" class="btn btn-primary" id="btnGuardar">Guardar</button>
				<button class="btn">Cancelar</button>
			</div>
		</form>
	</fieldset>
</div>
<script type="text/javascript">
var Publicacion  = {
	init : function(){		
		$(document).delegate("#btnGuardar","click",Publicacion.guardar);
	},
	guardar : function(e){
		e.preventDefault();
		form = $("#formulario-de-publicacion");
		if(form.validateForm() == 0){
			form.submit();
		}
	}
};
$(function(){
	Publicacion.init();
})
</script>